﻿
function SelectSearchResult(inp, data) {

    var proveedor = inp.id;

    var mainTabStrip = Ext.getCmp('RegionPanel1_mainRegion_mainTabStrip');
    var tabName = 'tab' + data[2];
    if (data[3] != '') {
        tabName = tabName + '-' + data[3];
    }

    var tabID = tabName; // data[8];
      var tab = Ext.getCmp(tabID);

      loadTab(mainTabStrip, tab, tabID, data[4], data[7], data[2]);
    
  }


  function loadTabFromForm( tabID,title,url) {


      var mainTabStrip = this.parent.Ext.getCmp('RegionPanel1_mainRegion_mainTabStrip');
      var tab = this.parent.Ext.getCmp(tabID);

      loadTab(mainTabStrip, tab, tabID, url, title, '');

  }




///------OBJ,OBJ,Name,URL,TTULO,ICONO--//
  function loadTab(mainTabStrip, tab, tabID, url, title, icon) {

                    if (tab) {
                        mainTabStrip.removeTab(tab);

                    }
                    mainTabStrip.addTab({
                        'id': tabID,
                        'url': url.replace('~/', ''),
                        'title': title,
                        'closable': true,
                        'bodyStyle': 'padding:0px; ',
                        'iconCls': 'icon_' + icon.replace(/[^.]+\./, '')
                    });


                }

 